package com.example.demo.service.zl;

import com.example.demo.dao.zl.PermissionRoledao;
import com.example.demo.entity.PermissionRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class PermissionRoleServiceImpl implements PermissionRoleService {
    @Autowired(required = true)
    PermissionRoledao permissionRoledao;
    @Override
    public List<PermissionRole> all66() {
        List<PermissionRole> permissionRoleList= permissionRoledao.all66();
        return permissionRoleList;
    }

    @Override
    public List<PermissionRole> insert9 (int sysRoleId, int sysPermissionId) {
        int insert9 = permissionRoledao.insert9(sysRoleId,sysPermissionId);
         if (insert9>=1){
            List<PermissionRole> roleListadd=permissionRoledao.all66();
            return roleListadd;
         } else {
             System.out.println("error insert");
            return null;
         }
    }

    @Override
    public int delete9(int id) {
        int delete9Single=permissionRoledao.delect9(id);
        if (delete9Single>=1){
            System.out.println("删除一行");
        return 1;
        }else{
            System.out.println("无数据");
            return 0;
        }
    }

    @Override
    public List<PermissionRole> update9( int sysRoleId, int sysPermissionId) {
        int update9=permissionRoledao.upade9(sysRoleId,sysPermissionId);
        if (update9>=1){
            List<PermissionRole> permissionRoleList =permissionRoledao.all66();
            return permissionRoleList;
        } else{
            return null;
    }
}

}